package com.sixth.util;

import org.springframework.stereotype.Component;

import java.text.SimpleDateFormat;
import java.util.Calendar;
import java.util.Date;

/**
 * @author ljh
 * @version 1.0
 * @describition:
 * @since 2022/9/7 19:30
 **/

@Component
public class DateUtils {
    private static SimpleDateFormat sdf = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss");
    public static String getFormatDate(Date date){
        return sdf.format(date);
    }
    private DateUtils(){}

    /**
     * 在原日期的基础上增加天数
     * @author lixinhang
     * @param date
     * @param i
     * @return
     */
    public static Date addDay(Date date,int i){
        Calendar c = Calendar.getInstance();
        c.setTime(date);
        c.add(Calendar.DATE,i);
        return  c.getTime();
    }

}
